import { createStore } from 'redux'
import reducers from './reducers'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2'
import Common from '@js/common'

const persistConfig = {
  key: 'root',
  storage: storage,
  stateReconciler: autoMergeLevel2, // 查看 'Merge Process' 部分的具体情况
  whitelist: ['basic']
}

const myPersistReducer = persistReducer(persistConfig, reducers)

const store = createStore(myPersistReducer)
Common.store = store

export const persistor = persistStore(store)
export default store
